package com.lsongh.springBoot.utils;

import com.lsongh.springBoot.entity.Result;

public class ResultUtil {
    /**
     * 成功获取数据后返回的结果
     *
     * @param body
     * @return
     */
    public static Result success(Object body) {
        Result result = new Result();
        result.setCode(0);
        result.setMessage("success");
        result.setBody(body);
        return result;
    }

    /**
     * 获取数据失败后返回的结果
     * @param message
     * @return
     */
    public static Result error(String message) {
        Result result = new Result();
        result.setCode(1);
        result.setMessage(message);
        result.setBody(null);
        return result;
    }


}
